﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    public abstract class A
    {
        public A()
        {
            Console.WriteLine('A');
        }
        public virtual void Fun()
        {
            Console.WriteLine("A.Fun()");
        }

    }
    public class B : A
    {
        public B()
        {
            Console.WriteLine('B');
        }

        //public new void Fun()
        //{
        //    Console.WriteLine("B.Fun()");
        //}

        public override void Fun()
        {
            Console.WriteLine("B.Fun()");
        }
    }

    public class C
    {
        public virtual void Fun1(int i)
        {
            Console.WriteLine(i);
        }
        public void Fun2(C c)
        {
            c.Fun1(1);
            Fun1(5);
        }
    }

    public class D : C
    {
        public override void Fun1(int i)
        {
            base.Fun1(i + 1);
        }
    }
}
